{extend name="common:base" /}

{block name="main"}
<!--body wrapper start-->
<div class="wrapper">
    <div class="row">
        <div class="col-md-12">
            <!--breadcrumbs start -->
            <ul class="breadcrumb panel">
                <li><a href="{:url('Index/index')}"><i class="fa fa-home"></i> 控制台</a></li>
                <li><a href="{:url('index')}">系统设置</a></li>
                <li class="active">数据备份</li>
            </ul>
            <!--breadcrumbs end -->
        </div>
    </div>

    <div class="row">
        <div class="col-sm-12">
            <section class="panel">
                <header class="panel-heading col-xs-12">

                    <form class="form-inline" action="{:url('')}">
                       <a href="#"  class="btn btn-success ajax-get" onclick="recharge();" title="数据备份">数据备份</a>

                    </form>
                </header>
            </section>
        </div>

    </div>
</div>
<!--body wrapper end-->
<!-- Modal -->
<div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="rechargeModal" class="modal fade">
    <div class="modal-dialog" style="width:500px;">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">数据备份</h4>
            </div>
            <form class="form-horizontal form-post-addmoney" action="" method="post">
                <div class="panel-body">
                    <form class="ids" action="{:url('del')}" method="post">
                        <table class="table">
                            <thead>
                            <tr>
                                <th>文件名</th>
                                <th>时间</th>
                                <th>大小</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name='backuplist' id='v'}
                            <tr>

                                <td>{$v.file}</td>
                                <td>{$v.date}</td>
                                <td>{$v.size}</td>
                            </tr>
                            {/volist}

                            </tbody>
                        </table>
                    </form>
                </div>
                <div class="modal-footer">
                    <button style="float: left" data-dismiss="modal" class="btn btn-success" type="button" onclick="Backup()">立即备份</button>
                    <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
                    <!--<button class="btn btn-primary " type="submit" target-form="form-post-addmoney">提交</button>-->
                </div>
            </form>
        </div>
    </div>
</div>
<!--body wrapper end-->
<!--body wrapper end-->

<script type="text/javascript" src="__JS__/layer/layer.js"></script>

<script type="text/javascript">
    function recharge() {
        $('#rechargeModal').modal('show');
    }
    function Backup() {
        $.ajax({
            type: "post",
            url: "{:url('backup')}",
            data: "",
            dataType: "json",
            async: false,
            success: function(data) {
                var msg = data.msg;
                layer.msg(msg,{icon:6,time:1000});
                setTimeout(function(){
                    location.reload()},1000
                );
            }
        });
    }
</script>

<!--body wrapper end-->
{/block}
